﻿using System.ComponentModel;

namespace NyanBankIntfTool
{
    class ProcessBarController : INotifyPropertyChanged
    {
        private double processCurrent;
        private double processTotal;
        public event PropertyChangedEventHandler PropertyChanged;

        private static ProcessBarController processBarControl;

        private ProcessBarController()
        {
        }

        public double ProcessCurrent
        {
            get => processCurrent;
            set
            {
                //processCurrent = (new Random()).Next() % 100;
                processCurrent = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("ProcessCurrent"));
                }
            }
        }

        public double ProcessTotal
        {
            get => processTotal;
            set
            {
                processTotal = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("ProcessTotal"));
                }
            }
        }

        public static ProcessBarController GetInstance()
        {
            if (processBarControl == null)
            {
                processBarControl = new ProcessBarController();
            }

            return processBarControl;
        }
    }
}